interface P1 {
  name: string;
  age: number;
}

interface P2 {
  name: string;
  sex: number;
}

const p1: P1 | P2 = {
  name: "jack",
  age: 18,
};

const p2: P1 | P2 = {
  name: "jack",
  sex: 1,
};

// const p3: P1 | P2 = {
//   name: "jack",
//   age: 18,
//   sex: 1,
// };

// 交叉类型
const p3: P1 & P2 = {
  name: "jack",
  age: 18,
  sex: 1,
};
